/*
 * Copyright (c) 2009.
 */

package kz.home.gui;

import kz.home.db.DBUtils;

import javax.microedition.lcdui.Display;
import java.util.Hashtable;
import java.util.Vector;

/**
 * User: danik
 * Date: 06.08.2009
 * Time: 0:36:25
 */
public class AddressForm extends BaseForm{
    private String cinemaID;

    public AddressForm(BaseForm mainScreen, Display display, Hashtable request, String cinemaID) {
        super("", mainScreen, display, request);

        this.cinemaID = cinemaID;

        init();
    }

    private void init() {
        deleteAll();

        Vector cinema = DBUtils.findInTable(DBUtils.CINEMAS, cinemaID);
        // String id, String cinemaName, String cinemaAddress, String state
        setTitle("Адрес кинотеатра");
        if (cinema == null || cinema.size() < 3) {
            append("Данные по кинотеатру с кодом [" + cinemaID + "] не найдены");
            return;
        }

        append("Кинотеатр: " + cinema.elementAt(1) + "\n");
        append("Адрес: " + cinema.elementAt(2));
    }
}
